# -*- coding = utf-8 -*-
# @Time    : 2025/3/27 下午1:06
# @Author  : yqk
# @File    : test.py
# @Software: PyCharm


import requests
from lxml import etree

cookies = {
    '__51vcke__3JxYmjWH7BbHTeTC': 'b5db4fc6-6c91-58f8-809b-fe021d73d9c5',
    '__51vuft__3JxYmjWH7BbHTeTC': '1743045114943',
    '__51uvsct__3JxYmjWH7BbHTeTC': '2',
    '__vtins__3JxYmjWH7BbHTeTC': '%7B%22sid%22%3A%20%22ba3aada0-f753-5aaa-aa13-4b0e8f172d9e%22%2C%20%22vd%22%3A%2011%2C%20%22stt%22%3A%20280998%2C%20%22dr%22%3A%2010%2C%20%22expires%22%3A%201743053342226%2C%20%22ct%22%3A%201743051542226%7D',
}

headers = {
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'accept-language': 'zh-CN,zh;q=0.9',
    'cache-control': 'max-age=0',
    'if-modified-since': 'Thu, 09 Jan 2025 06:55:51 GMT',
    'if-none-match': '"80b5fc846362db1:0"',
    'priority': 'u=0, i',
    'sec-ch-ua': '"Chromium";v="134", "Not:A-Brand";v="24", "Google Chrome";v="134"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'document',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'none',
    'sec-fetch-user': '?1',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36',
    # 'cookie': '__51vcke__3JxYmjWH7BbHTeTC=b5db4fc6-6c91-58f8-809b-fe021d73d9c5; __51vuft__3JxYmjWH7BbHTeTC=1743045114943; __51uvsct__3JxYmjWH7BbHTeTC=2; __vtins__3JxYmjWH7BbHTeTC=%7B%22sid%22%3A%20%22ba3aada0-f753-5aaa-aa13-4b0e8f172d9e%22%2C%20%22vd%22%3A%2011%2C%20%22stt%22%3A%20280998%2C%20%22dr%22%3A%2010%2C%20%22expires%22%3A%201743053342226%2C%20%22ct%22%3A%201743051542226%7D',
}

r = requests.get('https://www.geyan123.cn/aiqinggeyan/1251.html', cookies=cookies, headers=headers)
r.encoding = r.apparent_encoding
html = etree.HTML(r.text)

# 提取页面中的所有 <p> 标签的文本
content = html.xpath('//div[@class="content"]/p/text()')
print(content)
# 拼接所有 <p> 标签的文本
full_content = ''.join(content)